package com.zkthink.ceres.shoppingcart.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zkthink.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 购物车表
 * </p>
 *
 * @author vivi.huang
 * @since 2020-05-18
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_shopping_cart")
@ApiModel(value = "ShoppingCart", description = "购物车表")
@AllArgsConstructor
public class ShoppingCart extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @TableField("member_id")
    @Excel(name = "用户id")
    private Long memberId;

    /**
     * session
     */
    @ApiModelProperty(value = "session")
    @Length(max = 255, message = "session长度不能超过255")
    @TableField(value = "session_id", condition = LIKE)
    @Excel(name = "session")
    private String sessionId;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品id")
    @TableField("sku_id")
    @Excel(name = "商品id")
    private Long skuId;

    /**
     * 商品名称
     */
    @ApiModelProperty(value = "商品名称")
    @Length(max = 120, message = "商品名称长度不能超过120")
    @TableField(value = "product_name", condition = LIKE)
    @Excel(name = "商品名称")
    private String productName;

    /**
     * 零售价
     */
    @ApiModelProperty(value = "零售价")
    @Length(max = 120, message = "零售价长度不能超过120")
    @TableField(value = "sku_name", condition = LIKE)
    @Excel(name = "零售价")
    private String skuName;

    /**
     * 本店价(进货价)
     */
    @ApiModelProperty(value = "本店价(进货价)")
    @TableField("sku_price")
    @Excel(name = "本店价(进货价)")
    private Long skuPrice;

    /**
     * 购买数量
     */
    @ApiModelProperty(value = "购买数量")
    @TableField("buy_num")
    @Excel(name = "购买数量")
    private Integer buyNum;

    /**
     * 购物车选中状态
     */
    @ApiModelProperty(value = "购物车选中状态")
    @TableField("selected")
    @Excel(name = "购物车选中状态", replace = {"是_true", "否_false", "_null"})
    private Integer selected;

    /**
     * 加入购物车的时间
     */
    @ApiModelProperty(value = "加入购物车的时间")
    @TableField("add_time")
    @Excel(name = "加入购物车的时间")
    private Integer addTime;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public ShoppingCart(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    Long memberId, String sessionId, Long skuId, String productName, String skuName, 
                    Long skuPrice, Integer buyNum, Integer selected, Integer addTime, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.memberId = memberId;
        this.sessionId = sessionId;
        this.skuId = skuId;
        this.productName = productName;
        this.skuName = skuName;
        this.skuPrice = skuPrice;
        this.buyNum = buyNum;
        this.selected = selected;
        this.addTime = addTime;
        this.isDelete = isDelete;
    }

}
